package luogu;

import java.math.BigInteger;
import java.util.Scanner;

public class P1249 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = 0;
        BigInteger res = BigInteger.valueOf(1);
        if (n == 3){
            System.out.println(3);
            return;
        }
        if (n == 4){
            System.out.print(1 + " " + 3);
            System.out.println();
            System.out.println(3);
            return;
        }
        for (int i = 2; ; i++) {
            m += i;
            if (m == n){
                for (int j = 2; j <= i; j++) {
                    System.out.print(j + " ");
                    res = res.multiply(BigInteger.valueOf(j));
                }
                System.out.println();
                System.out.println(res);
                break;
            }
            if (m > n){
                int temp = m - n;
                if (temp == 1){
                    for (int j = 3; j <= i + 1; j++) {
                        if(j == i){
                            continue;
                        }
                        System.out.print(j + " ");
                        res = res.multiply(BigInteger.valueOf(j));
                    }
                    System.out.println();
                    System.out.println(res);
                    break;
                }
                for (int j = 2; j <= i; j++) {
                    if (j == temp){
                        continue;
                    }
                    System.out.print(j + " ");
                    res = res.multiply(BigInteger.valueOf(j));
                }
                System.out.println();
                System.out.println(res);
                break;
            }
        }
    }
}
